package com.jincp.image.pick;

import android.content.Intent;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class PickerContract {


	public static final Intent makeDataIntent(ArrayList<String> list) {
		Intent intent = new Intent();
		intent.putStringArrayListExtra("EXTRA_LISTS", list);
		return intent;
	}
	
	public static final ArrayList<String> getList(Intent intent) {
		return toList(intent.getSerializableExtra("EXTRA_LISTS"));
	}

	@SuppressWarnings("unchecked")
	private static final ArrayList<String> toList(Serializable list) {
		if (list != null && list instanceof List<?>) {
			return (ArrayList<String>) list;
		}
		return null;
	}
}
